import {
	request,
} from '@/api/request';
const apiList = [{
		// /api/index/getGoods
		name: 'getGoods',
		method: 'GET',
		url: '/api/index/getGoods',
	},
	{
		// /api/index/getGoodsDetail
		name: 'getGoodsDetail',
		method: 'GET',
		url: '/api/index/getGoodsDetail',
	},
	{
		// /api/goods/create
		name: 'goodscreate',
		url: '/api/goods/create',
	},
	{
		// /api/goods/edit
		name: 'edit',
		url: '/api/goods/edit',
	},
	// /api/goods/delete
	{
		name: 'delete',
		url: '/api/goods/delete',
	},
	// /api/order/create
	{
		name: 'ordercreate',
		url: '/api/order/create',
	},
	// /api/goods/sendGoods
	{
		name: 'sendGoods',
		url: '/api/goods/sendGoods',
	},
	// /api/order/list
	{
		name: 'orderlist',
		url: '/api/order/list',
		method: 'GET',
	},
	// /api/order/cancelOrder
	{
		name: 'cancelOrder',
		url: '/api/order/cancelOrder'
	},
	// /api/order/sendOrder
	{
		name: 'sendOrder',
		url: '/api/order/sendOrder'
	},
]

module.exports = apiList.reduce((mode, params) => {
	mode[params.name] = (data) => request({
		url: params.url,
		method: params.method || 'POST',
		data
	})
	return mode
}, {})